import router from './router/index'
import { getToken } from '@/utils/auth'


// 白名单列表 不限制登陆条件的访问页面列表
const whiteList = [
  '/login',
  '/'
]

// 路由拦截-beforeEach
router.beforeEach((to, from, next) => {
  if (getToken() && getToken() === '9527') {
    next()
  } else {
    if (whiteList.indexOf(to.path) !== -1) {
      next()
    } else {
      next({ path: '/login' })
    }
  }
})

router.afterEach((to, from) => {
  console.log("------- afterEach test -------");
})
